//
//  FootView.m
//  MyProject
//
//  Created by dllo on 15/11/6.
//  Copyright (c) 2015年 蓝鸥0825. All rights reserved.
//

#import "FootView.h"
#import "FoodCell.h"

#define WIDTH self.frame.size.width
#define HEIGHT self.frame.size.height

@implementation FootView

- (instancetype)initWithFrame:(CGRect)frame{
    
    self = [super initWithFrame:frame];
    if (self) {
        [self create];
    }
    return self;
}



- (void)create{
    
    self.table = [[UITableView alloc] init];
    [self addSubview:self.table];
    [self.table release];
    self.table.delegate = self;
    self.table.dataSource = self;
    self.table.frame = CGRectMake(0, 0, WIDTH, HEIGHT);
//    self.table.layer.borderWidth = 1;
    self.table.rowHeight = self.frame.size.height / 4;
}



- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return self.array.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    static NSString *reuse = @"reuse";
    FoodCell *cell = [tableView dequeueReusableCellWithIdentifier:reuse];
    if (!cell) {
        cell = [[FoodCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:reuse];
    }
    cell.model = self.array[indexPath.row];
    return cell;
    
}


@end
